package com.diligent.cloud.sfc.resources.impl;

import com.canny.commons.model.Result;
import com.diligent.cloud.sfc.model.OperationCompleteParams;
import com.diligent.cloud.sfc.model.OrderCompleteParams;
import com.diligent.cloud.sfc.resources.WoOperationResource;
import com.diligent.cloud.sfc.service.WoOperationService;
import com.diligent.cloud.workorder.model.WoOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * WoOperationResourceImpl class
 *
 * @author xf107278
 * @date 3/28/2020
 */
@RestController
public class WoOperationResourceImpl implements WoOperationResource {

    private WoOperationService woOperationService;

    public WoOperationResourceImpl(WoOperationService woOperationService) {
        this.woOperationService = woOperationService;
    }

    @Override
    public ResponseEntity<Result> addOrderComplete(OrderCompleteParams completeParams, Boolean isHanging,
                                                   Principal principal) {
        return woOperationService.addOrderComplete(completeParams, isHanging, principal);
    }

    @Override
    public ResponseEntity<Result> addOperation(WoOperation woOperation, Principal principal) {
        return woOperationService.addOperation(woOperation, principal);
    }

    @Override
    public ResponseEntity<Result> addOperationComplete(OperationCompleteParams operationCompleteParams, Principal principal) {
        return woOperationService.addOperationComplete(operationCompleteParams, principal);
    }
}
